package com.xinshujia.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.google.gson.annotations.JsonAdapter;
import com.xinshujia.configuration.adapter.LocalDateTimeAdapter;

import java.time.LocalDateTime;

/**
 * *************************************
 * *   @author: 野狼上校               **
 * *   @since: 2024-07-16 09:13       **
 * *   @version: 1.0                  **
 * *************************************
 * <p>
 *     所有实体类的父类
 */
public class BaseEntity {
    // 主键
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    // 更新时间
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime updateTime;

    // 新增时间
    @TableField(fill = FieldFill.INSERT)
    @JsonAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime createTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
}
